using System;
using UnityEngine;

public class AchivementDialogUI : MonoBehaviour
{
	public UILabel title;

	public UILabel description;

	public GameObject button;

	private Action onComplete;

	private bool initialized;

	private void Init()
	{
		if (!initialized)
		{
			base.gameObject.SetActive(false);
			initialized = true;
		}
	}

	public void ShowAchivement(GGStoryAchivementBase achivement, Action onComplete)
	{
		Init();
		this.onComplete = onComplete;
		base.gameObject.SetActive(true);
		title.text = achivement.name;
		description.text = achivement.GetDescription();
		if (button != null)
		{
			button.SetActive(false);
			this.WaitAndExecute(0.75f, delegate
			{
				button.SetActive(true);
			});
		}
	}

	public void OnButtonClick()
	{
		base.gameObject.SetActive(false);
		if (onComplete != null)
		{
			onComplete();
		}
	}
}
